class QueueList {
  String? name;
  String? code;
  String? userId;
  int? current;
  DateTime? createTime;

  // DateTime? lastCallTime;
  // DateTime? avgWaitingTime;
  String? bulletin;

  QueueList(
      {this.userId,
      this.code,
      this.current,
      this.createTime,
      this.name,
      this.bulletin});

  factory QueueList.fromJson(Map<String, dynamic> json) {
    print(json);
    // return switch (json) {
    //   {
    //     'name': String name,
    //     'code': int code,
    //     'uuid': String userId,
    //     'create_time': DateTime createTime,
    //     'current': int current,
    //   } =>
    //     QueueList(
    //         name: name,
    //         code: code as String,
    //         userId: userId,
    //         createTime: createTime,
    //         current: current),
    //   _ => throw const FormatException('Failed to load QueueList.')
    // };
    return QueueList(
        current: json['current'],
        createTime: DateTime.parse(json['create_time']),
        userId: json['uuid'],
        code: json['code'].toString().padLeft(4, '0'),
        name: json['name'],
        bulletin: json['bulletin'] ?? "");
  }
}
